import request from '@/config/axios'

// 店铺销售记录 VO
export interface SaleRecordVO {
  orderId: number // 订单ID
  memberId: number // 下单会员ID
  teamId: number // 店铺ID
  teamStaffId: number // 操作员工ID
  productId: number // 商品ID
  productCode: string // 商品编码
  costPrice: number // 成本价
  salePrice: number // 销售价
  refundNum: number // 退款数量
  refundMoney: number // 退款金额
  refundTime: Date // 退款时间
  refundReason: string // 退款原因
  discountMoney: number // 优惠金额
  identityDiscountMoney: number // 身份特权优惠
  dragonDiscountMoney: number // 接龙优惠
  isSpecial: number // 是否特价
  id: number // id
  productNum: number // 商品购买数量
  productMoney: number // 实付金额
  refundStatus: number // 退款状态
  refundType: number // 退款类型
  status: number // 状态
}

// 店铺销售记录 API
export const SaleRecordApi = {
  // 查询店铺销售记录分页
  getSaleRecordPage: async (params: any) => {
    return await request.get({ url: `/team/sale-record/page`, params })
  },

  // 查询店铺销售记录详情
  getSaleRecord: async (id: number) => {
    return await request.get({ url: `/team/sale-record/get?id=` + id })
  },

  // 新增店铺销售记录
  createSaleRecord: async (data: SaleRecordVO) => {
    return await request.post({ url: `/team/sale-record/create`, data })
  },

  // 修改店铺销售记录
  updateSaleRecord: async (data: SaleRecordVO) => {
    return await request.put({ url: `/team/sale-record/update`, data })
  },

  // 删除店铺销售记录
  deleteSaleRecord: async (id: number) => {
    return await request.delete({ url: `/team/sale-record/delete?id=` + id })
  },

  // 导出店铺销售记录 Excel
  exportSaleRecord: async (params) => {
    return await request.download({ url: `/team/sale-record/export-excel`, params })
  },
}